package com.dingup.provider.service.log.impl;

import com.dingup.api.enums.log.LogModelEnum;
import com.dingup.api.enums.log.LogUpdateTypeEnum;
import com.dingup.api.model.sys.SysLog;
import com.dingup.provider.mapper.SysLogMapper;
import com.dingup.provider.service.log.SysLogService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;
import java.util.List;

/**
 * Created by wancheng on 2018/8/28.
 */
@Service
public class SysLogServiceImpl implements SysLogService {

    @Autowired
    SysLogMapper sysLogMapper;
    @Override
    public void saveLog(String createUserId, LogUpdateTypeEnum updateType, String content, Integer modelId, LogModelEnum model) {
        SysLog log = new SysLog();
        log.setContent(content);
        log.setCreateTime(new Date());
        log.setCreateUserId(createUserId);
        log.setModel(model);
        log.setModelId(modelId);
        log.setUpdateType(updateType);
        sysLogMapper.insertSelective(log);
    }

    @Override
    public List<SysLog> getLog(List<LogUpdateTypeEnum> updateType, List<Integer> modelId, List<LogModelEnum> model) {
        return sysLogMapper.getLog(updateType,modelId,model);
    }

    @Override
    public List<SysLog> getClassLog(List<LogUpdateTypeEnum> updateType, List<Integer> modelId) {
        return sysLogMapper.getClassLog(updateType,modelId);
    }

    @Override
    public List<SysLog> getLessonLog(List<LogUpdateTypeEnum> updateType, List<Integer> modelId) {
        return sysLogMapper.getLessonLog(updateType,modelId);
    }
}
